#include <string>   
#include <cctype>
#include<iostream>
#include<map>
using namespace std;
enum Token_value {
	NAME,		NUMBER,		END,
	PLUS='+',	MINUS='-',	MUL='*',	DIV='/',
	PRINT=';',	ASSIGN='=',	LP='(',		RP=')'
};
class Calculator {
        
        double number_value;
        string string_value;
        double prim(bool get);
        double term(bool get);
        
        map<string, double> table;
    public: 
        Token_value current_token;
        Calculator();
        Token_value get_token();
        double expr(bool get);
    
    };
   
Calculator::Calculator()
    {
     current_token = PRINT;
    };
    
Token_value Calculator::get_token()
    {
    char ch;

        do {	// skip whitespace except '\en'
            if(!cin.get(ch)) return current_token = END;
        } while (ch!='\n' && isspace(ch));

	switch (ch) {
	case ';':
	case '\n':
		return current_token=PRINT;
	case '*':
	case '/':
	case '+':
	case '-':
	case '(':
	case ')':
	case '=':
		return current_token=Token_value(ch);
	case '0': case '1': case '2': case '3': case '4':
	case '5': case '6': case '7': case '8': case '9':
	case '.':
		cin.putback(ch);
		cin >> number_value;
        cout<<"lol??"<<endl;
		return current_token=NUMBER;
	default:			// NAME, NAME=, or error
		if (isalpha(ch)) {
            
			string_value = ch;
			while (cin.get(ch) && isalnum(ch))
				string_value += ch;	// string_value.push_back(ch);
							// to work around library bug
			cin.putback(ch);
            cout << string_value;
			return current_token=NAME;
		}
		//error("bad token");
		return current_token=PRINT;
	}
    }
 double Calculator::prim(bool get)
 {	
    if (get) get_token();

	switch (current_token) {
	case NUMBER:		// floating-point constant
	{	double v = number_value;
		get_token();
		return v;
	}
	case NAME:
	{	double& v = table[string_value];
		if (get_token() == ASSIGN) v = expr(true);
		return v;
	}
	case MINUS:		// unary minus
		return -prim(true);
	case LP:
	{	double e = expr(true);
		//if (current_token != RP) return error(") expected");
		get_token();		// eat ')'
		return e;
	}
//	default:
//		return error("primary expected");
	}
 }
 
 double Calculator::term(bool get)
 {
	double left = prim(get);

	for (;;)
		switch (current_token) {
		case MUL:
			left *= prim(true);
			break;
		case DIV:
			if (double d = prim(true)) {
				left /= d;
				break;
			}
//			return error("divide by 0");
		default:
			return left;
		}
}
 double Calculator::expr(bool get)
{
	double left = term(get);

	for (;;)				// ``forever''
		switch (current_token) {
		case PLUS:
			left += term(true);
			break;
		case MINUS:
			left -= term(true);
			break;
		default:
			return left;
		}
}
 

int main()
{
 Calculator Kalcul;
 	while (cin) {
        //cout<<"!"<<endl;
		Kalcul.get_token();
		if (Kalcul.current_token == END) break;
		if (Kalcul.current_token == PRINT) continue;
		cout << Kalcul.expr(false) << '\n';
	}

 return 0;
}